<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改风险名称')" />
    <th:block th:include="include :: summernote-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-hiddenName-edit" th:object="${hiddenName}">
            <input name="riskId" th:field="*{riskId}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">风险编码：</label>
                <div class="col-sm-8">
                    <input name="riskCode" th:field="*{riskCode}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">风险名称：</label>
                <div class="col-sm-8">
                    <input name="riskName" th:field="*{riskName}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">所属系统：</label>
                <div class="col-sm-8">
                    <select name="sysId" th:with="item=${@dict.selectHiddenSysList()}" class="form-control" required>
                        <option value="">所有</option>
                        <option th:each="dict : ${item}" th:text="${dict.sysName}"
                                th:value="${dict.sysId}" th:field="*{sysId}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">所属环节：</label>
                <div class="col-sm-8">
                    <select name="linkId" th:with="item=${@dict.selectHiddenLinkList()}" class="form-control" required>
                        <option value="">所有</option>
                        <option th:each="dict : ${item}" th:text="${dict.linkName}"
                                th:value="${dict.linkId}" th:field="*{sysId}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">风险等级：</label>
                <div class="col-sm-8">
                    <input name="riskLevel" th:field="*{riskLevel}" class="form-control" type="text" required>
                </div>
            </div>
            <!--<div class="form-group">
                <label class="col-sm-3 control-label">风险要素：</label>
                <div class="col-sm-8">
                    <input name="riskEle" th:field="*{riskEle}" class="form-control" type="text">
                </div>
            </div>

            <div class="form-group">    
                <label class="col-sm-3 control-label">作业地点：</label>
                <div class="col-sm-8">
                    <input name="workAddr" th:field="*{workAddr}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">任务名称：</label>
                <div class="col-sm-8">
                    <input name="taskName" th:field="*{taskName}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">执行单位：</label>
                <div class="col-sm-8">
                    <input name="executeUnit" th:field="*{executeUnit}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">适用岗位：</label>
                <div class="col-sm-8">
                    <input name="suitPost" th:field="*{suitPost}" class="form-control" type="text">
                </div>
            </div>

            <div class="form-group">    
                <label class="col-sm-3 control-label">风险值：</label>
                <div class="col-sm-8">
                    <input name="riskValue" th:field="*{riskValue}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">风险类型：</label>
                <div class="col-sm-8">
                    <select name="riskType" class="form-control m-b">
                        <option value="">所有</option>
                    </select>
                    <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">风险内容：</label>
                <div class="col-sm-8">
                    <input type="hidden" class="form-control" th:field="*{riskContent}">
                    <div class="summernote" id="riskContent"></div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">风险后果：</label>
                <div class="col-sm-8">
                    <input name="riskResult" th:field="*{riskResult}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">合格特征：</label>
                <div class="col-sm-8">
                    <input name="passFeature" th:field="*{passFeature}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">检查周期：</label>
                <div class="col-sm-8">
                    <input name="checkCycle" th:field="*{checkCycle}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">整改措施：</label>
                <div class="col-sm-8">
                    <input name="reformIdea" th:field="*{reformIdea}" class="form-control" type="text">
                </div>
            </div>-->
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: summernote-js" />
    <script th:inline="javascript">
        var prefix = ctx + "hidden/hiddenName";
        $("#form-hiddenName-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-hiddenName-edit').serialize());
            }
        }

        $(function() {
            $('.summernote').each(function(i) {
                $('#' + this.id).summernote({
                    lang: 'zh-CN',
                    callbacks: {
                        onChange: function(contents, $edittable) {
                            $("input[name='" + this.id + "']").val(contents);
                        },
                        onImageUpload: function(files) {
                            var obj = this;
                            var data = new FormData();
                            data.append("file", files[0]);
                            $.ajax({
                                type: "post",
                                url: ctx + "common/upload",
                                data: data,
                                cache: false,
                                contentType: false,
                                processData: false,
                                dataType: 'json',
                                success: function(result) {
                                    if (result.code == web_status.SUCCESS) {
                                        $('#' + obj.id).summernote('insertImage', result.url);
                                    } else {
                                        $.modal.alertError(result.msg);
                                    }
                                },
                                error: function(error) {
                                    $.modal.alertWarning("图片上传失败。");
                                }
                            });
                        }
                    }
                });
                var content = $("input[name='" + this.id + "']").val();
                $('#' + this.id).summernote('code', content);
            })
        });
    </script>
</body>
</html>